package br.ufrn.engcomp.cadastro.dao;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import br.ufrn.engcomp.arq.dao.GenericDAO;
import br.ufrn.engcomp.arq.exceptions.DAOException;
import br.ufrn.engcomp.cadastro.dominio.Aluno;

/**
 *
 *@author claudio
 *
 */

public class AlunoDAO extends GenericDAO<Aluno> {
	
	public List<Aluno> findBySQL(String query) throws DAOException {
		EntityManager em = getEntityManager();
		List<Aluno> retorno = new ArrayList<Aluno>();
		try {
			Query q = em.createQuery(query);
			retorno = q.getResultList();
		} catch (Exception ex) {
			throw new DAOException(ex);
		} finally{
			em.close();
		}
		return retorno;
	}

}
